using System;
using System.Collections.Generic;
using System.ComponentModel;
using XCode;
using XCode.Configuration;
using XCode.DataAccessLayer;

namespace Model.Xcode
{
    /// <summary></summary>
    [Serializable]
    [DataObject]
    [BindTable("DingTalkDepartmentTrees", Description = "", ConnName = "DefaultDB", DbType = DatabaseType.SqlServer)]
    public partial class DingTalkDepartmentTrees : IDingTalkDepartmentTrees
    {
        #region 属性
        private Int32 _Id;
        /// <summary></summary>
        [DisplayName("Id")]
        [DataObjectField(true, true, false, 10)]
        [BindColumn("Id", "", "int")]
        public Int32 Id { get => _Id; set { if (OnPropertyChanging(__.Id, value)) { _Id = value; OnPropertyChanged(__.Id); } } }

        private String _DdID;
        /// <summary></summary>
        [DisplayName("DdID")]
        [DataObjectField(false, false, false, 50)]
        [BindColumn("DD_Id", "", "varchar(50)")]
        public String DdID { get => _DdID; set { if (OnPropertyChanging(__.DdID, value)) { _DdID = value; OnPropertyChanged(__.DdID); } } }

        private String _DepartmentId;
        /// <summary></summary>
        [DisplayName("DepartmentId")]
        [DataObjectField(false, false, false, 50)]
        [BindColumn("DepartmentId", "", "varchar(50)")]
        public String DepartmentId { get => _DepartmentId; set { if (OnPropertyChanging(__.DepartmentId, value)) { _DepartmentId = value; OnPropertyChanged(__.DepartmentId); } } }

        private String _FullName;
        /// <summary></summary>
        [DisplayName("FullName")]
        [DataObjectField(false, false, false, 100)]
        [BindColumn("FullName", "", "nvarchar(100)")]
        public String FullName { get => _FullName; set { if (OnPropertyChanging(__.FullName, value)) { _FullName = value; OnPropertyChanged(__.FullName); } } }

        private String _ParentDepartmentId;
        /// <summary></summary>
        [DisplayName("ParentDepartmentId")]
        [DataObjectField(false, false, true, 50)]
        [BindColumn("ParentDepartmentId", "", "varchar(50)")]
        public String ParentDepartmentId { get => _ParentDepartmentId; set { if (OnPropertyChanging(__.ParentDepartmentId, value)) { _ParentDepartmentId = value; OnPropertyChanged(__.ParentDepartmentId); } } }

        private DateTime _CreateDate;
        /// <summary></summary>
        [DisplayName("CreateDate")]
        [DataObjectField(false, false, true, 3)]
        [BindColumn("CreateDate", "", "datetime", Precision = 0, Scale = 3)]
        public DateTime CreateDate { get => _CreateDate; set { if (OnPropertyChanging(__.CreateDate, value)) { _CreateDate = value; OnPropertyChanged(__.CreateDate); } } }

        private Int32 _Level;
        /// <summary></summary>
        [DisplayName("Level")]
        [DataObjectField(false, false, true, 10)]
        [BindColumn("level", "", "int")]
        public Int32 Level { get => _Level; set { if (OnPropertyChanging(__.Level, value)) { _Level = value; OnPropertyChanged(__.Level); } } }

        private String _DdParentid;
        /// <summary></summary>
        [DisplayName("DdParentid")]
        [DataObjectField(false, false, true, 50)]
        [BindColumn("DD_ParentId", "", "varchar(50)")]
        public String DdParentid { get => _DdParentid; set { if (OnPropertyChanging(__.DdParentid, value)) { _DdParentid = value; OnPropertyChanged(__.DdParentid); } } }
        #endregion

        #region 获取/设置 字段值
        /// <summary>获取/设置 字段值</summary>
        /// <param name="name">字段名</param>
        /// <returns></returns>
        public override Object this[String name]
        {
            get
            {
                switch (name)
                {
                    case __.Id: return _Id;
                    case __.DdID: return _DdID;
                    case __.DepartmentId: return _DepartmentId;
                    case __.FullName: return _FullName;
                    case __.ParentDepartmentId: return _ParentDepartmentId;
                    case __.CreateDate: return _CreateDate;
                    case __.Level: return _Level;
                    case __.DdParentid: return _DdParentid;
                    default: return base[name];
                }
            }
            set
            {
                switch (name)
                {
                    case __.Id: _Id = value.ToInt(); break;
                    case __.DdID: _DdID = Convert.ToString(value); break;
                    case __.DepartmentId: _DepartmentId = Convert.ToString(value); break;
                    case __.FullName: _FullName = Convert.ToString(value); break;
                    case __.ParentDepartmentId: _ParentDepartmentId = Convert.ToString(value); break;
                    case __.CreateDate: _CreateDate = value.ToDateTime(); break;
                    case __.Level: _Level = value.ToInt(); break;
                    case __.DdParentid: _DdParentid = Convert.ToString(value); break;
                    default: base[name] = value; break;
                }
            }
        }
        #endregion

        #region 字段名
        /// <summary>取得DingTalkDepartmentTrees字段信息的快捷方式</summary>
        public partial class _
        {
            /// <summary></summary>
            public static readonly Field Id = FindByName(__.Id);

            /// <summary></summary>
            public static readonly Field DdID = FindByName(__.DdID);

            /// <summary></summary>
            public static readonly Field DepartmentId = FindByName(__.DepartmentId);

            /// <summary></summary>
            public static readonly Field FullName = FindByName(__.FullName);

            /// <summary></summary>
            public static readonly Field ParentDepartmentId = FindByName(__.ParentDepartmentId);

            /// <summary></summary>
            public static readonly Field CreateDate = FindByName(__.CreateDate);

            /// <summary></summary>
            public static readonly Field Level = FindByName(__.Level);

            /// <summary></summary>
            public static readonly Field DdParentid = FindByName(__.DdParentid);

            static Field FindByName(String name) => Meta.Table.FindByName(name);
        }

        /// <summary>取得DingTalkDepartmentTrees字段名称的快捷方式</summary>
        public partial class __
        {
            /// <summary></summary>
            public const String Id = "Id";

            /// <summary></summary>
            public const String DdID = "DdID";

            /// <summary></summary>
            public const String DepartmentId = "DepartmentId";

            /// <summary></summary>
            public const String FullName = "FullName";

            /// <summary></summary>
            public const String ParentDepartmentId = "ParentDepartmentId";

            /// <summary></summary>
            public const String CreateDate = "CreateDate";

            /// <summary></summary>
            public const String Level = "Level";

            /// <summary></summary>
            public const String DdParentid = "DdParentid";
        }
        #endregion
    }

    /// <summary>接口</summary>
    public partial interface IDingTalkDepartmentTrees
    {
        #region 属性
        /// <summary></summary>
        Int32 Id { get; set; }

        /// <summary></summary>
        String DdID { get; set; }

        /// <summary></summary>
        String DepartmentId { get; set; }

        /// <summary></summary>
        String FullName { get; set; }

        /// <summary></summary>
        String ParentDepartmentId { get; set; }

        /// <summary></summary>
        DateTime CreateDate { get; set; }

        /// <summary></summary>
        Int32 Level { get; set; }

        /// <summary></summary>
        String DdParentid { get; set; }
        #endregion

        #region 获取/设置 字段值
        /// <summary>获取/设置 字段值</summary>
        /// <param name="name">字段名</param>
        /// <returns></returns>
        Object this[String name] { get; set; }
        #endregion
    }
}